<?php
include 'config.php';

$id = $_POST['userID'];
$type = $_POST['type'];
$credit = $_POST['credit'];
$password = $_POST['password'];
if (!$type == 'credit') {
    $sql = "UPDATE `user` SET password='$password' WHERE id=$id";
    mysql_query($sql);
    echo 'pass';
} else {
    $sql = "UPDATE `user` SET credit='$credit' WHERE id=$id";
    mysql_query($sql);
    echo'credit';
}
//
//echo '<div id="userProfileAreaInputCredit">
//                    <p>Credit Card</p>';
//$sql = "SELECT * FROM `user` WHERE id = " . $_SESSION['id'] . "";
//$result = mysql_query($sql);
//$row = mysql_fetch_array($result);
//echo '<input type="text" id="creditInput" content="' . $_SESSION['id'] . '" value="' . $row['credit'] . '" size="50px"/>
//<input type="button" id="UpdateCredit" style="background-color: #0080FF; border: none; padding: 2px; border-radius:2px; color: white;" value="Update"/>
//</div>
//<div id="userProfileAreaInputPassword">
//<p> Password : </p >';
//$sql = "SELECT * FROM `user` WHERE id = " . $_SESSION['id'] . "";
//$result = mysql_query($sql);
//$row = mysql_fetch_array($result);
//echo '<input type="text" id="passwordInput" content="' . $_SESSION['id'] . '"  value="' . $row['password'] . '" size="50px"/>
//<input type="button" id="UpdatePassword" style="background-color: #0080FF; border: none; padding: 2px; border-radius:2px; color: white;" value="Update"/>
//</div>';
?>
